﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Interfaces;

namespace Model
{
    public class HomepartyCollection
    {
        List<Homeparty> homeparties;

        public HomepartyCollection()
        {
            homeparties = new List<Homeparty>();
        }

        
        public Homeparty TilføjHomeparty(int homePartyNr, Kunde værtinde, DateTime dato, int region, Sælger sælgerNr,
            List<Kunde> gæsteliste)
        {
            gæsteliste = new List<Kunde>();
            Homeparty homeparty = new Homeparty(homePartyNr, værtinde, dato, (Landsdel)region, sælgerNr, gæsteliste);
            homeparties.Add(homeparty);
            return homeparty;
        }

        //public Homeparty TilføjHomeparty(int id, Kunde værtinde, DateTime dato, Landsdel region, Sælger sælger)
        //{
        //Homeparty homeparty = new Homeparty(id, værtinde, dato, region, sælger);
        //homeparties.Add(homeparty);
        //return homeparty;
        //}

        //public Homeparty TilføjHomeparty(int id, Kunde værtinde, DateTime dato, Landsdel region)
        //{
        //    Homeparty homeparty = new Homeparty(id, værtinde, dato, region);
        //    homeparties.Add(homeparty);
        //    return homeparty;
        //}

        public void SletHomeparty(int id)
        {
            Homeparty homeparty = FindHomeparty(id);
            if (homeparty != null)
            {
                homeparties.Remove(homeparty);
            }
        }

        public Homeparty FindHomeparty(int id)
        {
            foreach (Homeparty homeparty in homeparties)
            {
                if (homeparty.Id == id)
                    return homeparty;
            }
            return null;
        }

        public List<Homeparty> FindHomeparty(DateTime dato)
        {
            List<Homeparty> homepartys = new List<Homeparty>();

            foreach (Homeparty homeparty in homeparties)
            {
                if (homeparty.Dato == dato)
                { homepartys.Add(homeparty); }
            }
            return homepartys;
        }

        // Steffen
        public List<Homeparty> HentHomepartyListe()
        {
            return homeparties;
        }

        //public void TilføjGæst(Kunde kunde)
        //{
            
        //    gæsteliste.Add(kunde);
        //}

        #region Properties
        public List<Homeparty> Homeparties
        {
            get { return homeparties; }
            set { homeparties = value; }
        }
        #endregion
    }
}
